#!/usr/bin/env python3
# -*- coding:utf-8 -*-
#   mail: infaaf@126.com

from app01.models import  Customer,CustomerFollowUp
enabled_admins={}

class BaseAdmin:
    list_display=[]
    list_filters=[]


class CustomerAdmin(BaseAdmin):
    model=None
    list_display = ('qq', 'phone','source')

class CustomerFollowUpAdmin(BaseAdmin):
    list_display = ('customer','content')
    model=Customer

def register(model_class,admin_class=None):
    if not admin_class:
        admin_class=BaseAdmin

    appname=model_class._meta.app_label
    modelname=model_class._meta.model_name
    admin_class.model=model_class
    if appname not in enabled_admins:
        enabled_admins[appname]={}
    enabled_admins[appname][modelname]=admin_class # en[app][model]=adminmodel     {app:{model:modeladmin,model2:mode2admin}}



register(Customer,CustomerAdmin)
# register(CustomerFollowUp,CustomerFollowUpAdmin)






